Skip to content

Remove fetching from GitHub release assets#62

Merged
j-wags merged 13 commits intomainfrom
fetch-by-doi2
Aug 7, 2025
Merged

Remove fetching from GitHub release assets#62
j-wags merged 13 commits intomainfrom
fetch-by-doi2

Conversation

@j-wags
Copy link
Copy Markdown
Member

@j-wags j-wags commented Jul 15, 2025

#42 (which isn't in a release) added a feature where, when a model filename that isn't in the python package or cache is requested, openff-nagl-models queries the releases of the openff-nagl-models repo on GitHub to see if it can be fetched. Unfortunately, these release asset queries have started returning 403 "rate limiting" errors, since several tests are given nonexistent filenames to test error behavior. While this problem could be resolved using cleverer caching to reduce the number of queries or by mocking metadata fetching in tests, I don't think the behavior is worth the complexity. This PR removes the fetching-from-GH-release-assets behavior while preserving the fetching-from-zenodo-doi behavior defined in the SMIRNOFF EP.

@j-wags j-wags changed the title Mock fetching for more tests to avoid rate limiting Remove fetching from GitHub release assets Aug 4, 2025
Copy link
Copy Markdown
Member Author

@j-wags j-wags left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes to self:

  • Is using lru_cache on get_model harmful when stacked on local cache dir?
  • Does this block toolkit or interchange PR?

j-wags added 3 commits August 6, 2025 10:02
…e so they stop interfering, clean up unused monkeypatching now that release assets aren't checked
Copy link
Copy Markdown
Member

@mattwthompson mattwthompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! A few small clarifications and suggestions for improvements in tests. None blocking

Comment thread openff/nagl_models/_dynamic_fetch.py Outdated
Comment thread openff/nagl_models/_dynamic_fetch.py Outdated
Comment thread openff/nagl_models/_dynamic_fetch.py Outdated
Comment on lines +92 to +94
get_model(
"my_favorite_model.pt",
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we be extra explicit about where the file is and isn't?

  • Assert that this file is not in the installed Python package (I'd be surprised if it ever was) - feel free to do this anywhere in this test, I want to make sure that the checks into the cache and/or internet actually go there and aren't broken if we accidentally ship our "favorite" little model
  • Assert that this file is present in the cache location

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

Comment thread openff/nagl_models/tests/test_dynamic_fetch.py Outdated
# Ensure that cached files can be accessed when only doi is provided
get_model(
"my_favorite_model.pt",
doi="10.5072/zenodo.278300",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) I can't figure out a good way (or reason to) test this, but I was a little surprised that an incorrect (but correctly-formatted) DOI could be passed here and it might not necessarily match the contents on Zenodo

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I somewhat addressed this in a spec clarification openforcefield/standards@2b6ef83

match="Could not find asset with name 'FOOBAR"):
get_model("FOOBAR.pt")

def test_error_on_bad_file_suffix():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this behavior should not reach out to the internet, it would be nice to have this test run with and without the socket turned off. Same with test_error_on_bad_file_suffix.

@j-wags j-wags marked this pull request as ready for review August 7, 2025 15:18
@j-wags j-wags merged commit 49dfe37 into main Aug 7, 2025
5 checks passed
@j-wags j-wags deleted the fetch-by-doi2 branch August 7, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI has failed for 2 days in a row

2 participants